<?php
$sort1=isset($_GET['sort'])?'&sort='.$_GET['sort']:'';
$cs=Yii::app()->clientScript;
$cs->registerScript('gas_incentive',<<<END
$("#excel").click(
function(){
	var act=$("form").attr('action');
	$("form").attr('action',act+'&excel=1$sort1').attr('target','_blank').submit().attr('action',act).attr('target','');
}
);
END
);
?>
<h2>油耗奖惩表</h2>
<?php echo CHtml::beginForm(array('gas_incentive'),'post');?>
<table  style="margin: 0 auto;"  width="1270">
<tr><td>
	车牌号：<input type="text" name="keys[plate_no]" size="5" value="<?php echo isset($_GET['keys']['plate_no'])?$_GET['keys']['plate_no']:'';?>"/>
	司机姓名：<input type="text" name="keys[driver_name]" size="5" value="<?php echo isset($_GET['keys']['driver_name'])?$_GET['keys']['driver_name']:'';?>"/>
	时间：<input type="text" id="keys[s_date]" name="keys[s_date]" size="7" value="<?php echo isset($_GET['keys']['s_date'])?$_GET['keys']['s_date']:'';?>"/>
	<?php $this->widget('application.extensions.calendar.SCalendar',array('inputField'=>'keys[s_date]','ifFormat'=>'%Y-%m'));?>
	模糊查询：<?php echo CHtml::radioButtonList('keys[blur]',isset($_GET['keys']['blur'])?$_GET['keys']['blur']:1,array(1=>'是',0=>'否'),array('separator'=>' '));?>
	<input type="submit" value="搜索"/>&nbsp;&nbsp;&nbsp;&nbsp;<input id="excel" type="button" value="输出excel文件"/>
</td></tr></table>
<?php echo CHtml::endForm();?>
<table class="dataGrid" width="1270">
  <thead>
  <tr>
    <th  width="70"><?php echo $sort->link('plate_no'); ?></th>
    <th  width="120"><?php echo $sort->link('type_name'); ?></th>
    <th  width="70"><?php echo $sort->link('driver_name'); ?></th>
    <th  width="70"><?php echo $sort->link('fuel'); ?></th>
    <th  width="70"><?php echo $sort->link('actual_gas_fee'); ?></th>
    <th  width="70"><?php echo $sort->link('total_mileage'); ?></th>
    <th  width="70"><?php echo $sort->link('front_driving_mileage'); ?></th>
    <th  width="70"><?php echo $sort->link('empty_driving_mileage'); ?></th>
    <th  width="70"><?php echo $sort->link('light_driving_mileage'); ?></th>
    <th  width="70"><?php echo $sort->link('heavy_driving_mileage'); ?></th>
    <th  width="70"><?php echo $sort->link('front_fuel'); ?></th>
    <th  width="70"><?php echo $sort->link('empty_fuel'); ?></th>
    <th  width="70"><?php echo $sort->link('light_fuel'); ?></th>
    <th  width="70"><?php echo $sort->link('heavy_fuel'); ?></th>
    <th  width="70"><?php echo $sort->link('ideal_gas_fee'); ?></th>
    <th  width="70"><?php echo $sort->link('incentive_amount'); ?></th>
    <th  width="100"><?php echo $sort->link('stat_date'); ?></th>
  </tr>
  </thead>
  <tbody>
<?php foreach($models as $n=>$model): ?>
  <tr class="<?php echo $n%2?'even':'odd';?>">
    <td><?php echo $model->plate_no; ?></td>
    <td><?php echo CHtml::encode($model->type_name); ?></td>
    <td><?php echo CHtml::encode($model->driver_name); ?></td>
    <td><?php echo CHtml::encode($model->fuel); ?></td>
    <td><?php echo CHtml::encode($model->actual_gas_fee); ?></td>
    <td><?php echo CHtml::encode($model->total_mileage); ?></td>
    <td><?php echo CHtml::encode($model->front_driving_mileage); ?></td>
    <td><?php echo CHtml::encode($model->empty_driving_mileage); ?></td>
    <td><?php echo CHtml::encode($model->light_driving_mileage); ?></td>
    <td><?php echo CHtml::encode($model->heavy_driving_mileage); ?></td>
    <td><?php echo CHtml::encode($model->front_fuel); ?></td>
    <td><?php echo CHtml::encode($model->empty_fuel); ?></td>
    <td><?php echo CHtml::encode($model->light_fuel); ?></td>
    <td><?php echo CHtml::encode($model->heavy_fuel); ?></td>
    <td><?php echo CHtml::encode($model->ideal_gas_fee); ?></td>
    <td><?php echo CHtml::encode($model->incentive_amount); ?></td>
    <td><?php echo CHtml::encode($model->stat_date); ?></td>
  </tr>
<?php endforeach; ?>
  </tbody>
</table>
<br/>
<?php $this->widget('CLinkPager',array('pages'=>$pages,'htmlOptions'=>array('style'=>'width:1270px;'))); ?>
